package com.smrtcold.dev.dto.dev.base;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * Copyright (C) SmartCold 版权所有
 *
 * @author MaQiang34
 * @Description: 设备监控信息
 * @createDate:2018-11-28 16:52
 * @version:V1.0
 */
@Data
public class DevInfo implements Serializable, Cloneable {
    private Double mis, du;//信号强度,设备电压
    private Integer id, uri, mid, type, agree, activation, status, energytage, net,count;
    private String uuid, apid, devid, token, name, pmname, confmapping, datamapping, warmapping,
            coordinate, expmapping, ctlmapping, parmapping,
            driveversion, confversion, addtime, lastcontime, updatetime, notices;

    private List<String> names;

    private static final Long serialVersionUID = 0L;

    public DevInfo() {
    }

    public DevInfo(String devid, Integer status) {
        this.status = status;
        this.devid = devid;
    }

    public DevInfo(Integer type, String devid) {
        this.type = type;
        this.devid = devid;
    }

    public DevInfo(String devid, int status, Double du, Double mis) {
        this.mis = mis;
        this.du = du;
        this.status = status;
        this.devid = devid;
    }

    public DevInfo(Integer type, String devid, Integer status, Double du, Double mis) {
        this.type = type;
        this.devid = devid;
        this.status = status;
        this.du = du;
        this.mis = mis;
    }

    public DevInfo(Integer type, String apid, String devid) {
        this.type = type;
        this.apid = apid;
        this.devid = devid;
    }

    public DevInfo(Integer mid, Integer type, String apid, String devid, String name) {
        this.mid = mid;
        this.type = type;
        this.apid = apid;
        this.devid = devid;
        this.name = name;
    }

    public DevInfo(Double mis, Double du, Integer id, Integer mid, Integer type, Integer activation, Integer status, Integer net, String apid, String devid, String name, String confmapping, String datamapping, String warmapping, String coordinate, String expmapping, String ctlmapping, String driveversion, String confversion, String addtime, String lastcontime, String updatetime) {
        this.mis = mis;
        this.du = du;
        this.id = id;
        this.mid = mid;
        this.type = type;
        this.activation = activation;
        this.status = status;
        this.net = net;
        this.apid = apid;
        this.devid = devid;
        this.name = name;
        this.confmapping = confmapping;
        this.datamapping = datamapping;
        this.warmapping = warmapping;
        this.coordinate = coordinate;
        this.expmapping = expmapping;
        this.ctlmapping = ctlmapping;
        this.driveversion = driveversion;
        this.confversion = confversion;
        this.addtime = addtime;
        this.lastcontime = lastcontime;
        this.updatetime = updatetime;
    }

    public boolean isChange(Double du, Double mis) {
        return this.du != du || this.mis != mis;
    }


    @Override
    public DevInfo clone() {
        try {
            return (DevInfo) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return this;
    }

}
